import React from 'react'
import axios from 'axios'

/*eslint-disable*/
export default class TestApi extends React.Component {
  getTopics() {
    axios.get('/api/topics')
      .then(resp => {
        console.log(resp)
      })
      .catch(err => {
        console.log(err)
      })
  }

  login() {
    axios.post('/api/user/login', {
      accessToken: '895977c8-3e5e-4322-8291-89ad8b22b211'
    }).then(resp => {
        console.log(resp)
      })
      .catch(err => {
        console.log(err)
      })
  }

  markAll() {
    axios.post('/api/message/mark_all?needAccessToken=true', {
      accessToken: '895977c8-3e5e-4322-8291-89ad8b22b211'
    }).then(resp => {
        console.log(resp)
      })
      .catch(err => {
        console.log(err)
      })
  }

  render() {
    return (
      <div>
        <button onClick={this.getTopics}>getTopics</button>
        <button onClick={this.login}>login</button>
        <button onClick={this.markAll}>markAll</button>
      </div>
    )
  }
}
